//引入列表接口
import { menuList } from '../../../request/api'
const state = {
    menulist: []
}
const getters = {
    getMenu(state) {
        return state.menulist
    }
}
const mutations = {
    REQ_LIST(state, payload) {
        state.menulist = payload
    }
}
const actions = {
    getMenuAction({ commit }) {
        //组件一加载就调用列表接口
        menuList()
            .then(res => {
                console.log(res, '菜单列表');
                if (res.code == 200) {
                    commit('REQ_LIST', res.list)
                }
            })
    }
}


export default {
    state,
    getters,
    mutations,
    actions,
    //开启命名空间
    namespaced: true
}